﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace DuelQuizzServer
{
    public partial class Answer
    {
        private static Entities context;
        private static DbSet<Answer> entities
        {
            get
            {
                if (Answer.context == null)
                {
                    Answer.context = new Entities();
                    Answer.context.Configuration.ProxyCreationEnabled = false;
                    Answer.context.Configuration.LazyLoadingEnabled = true;
                }
                return context.Answer;
            }
        }

        internal static List<Answer> getAnswerFromQuestion(Question question) {
            List<Answer> list= Answer.entities.Where(a => (a.question_id == question.id)).ToList();
            if (list == null) return new List<Answer>();
            else return list;
        }
    }
}